<?php

namespace app\admin\model;

use think\Model;

class Order extends Model
{
    // 表名
    protected $name = 'order';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'order_status_text'
    ];
    

    
    public function getOrderStatusList()
    {
        return ['0' => __('Order_status 0'),'1' => __('Order_status 1'),'2' => __('Order_status 2'),'10' => __('Order_status 10'),'11' => __('Order_status 11'),'12' => __('Order_status 12'),'13' => __('Order_status 13'),'20' => __('Order_status 20'),'90' => __('Order_status 90'),'91' => __('Order_status 91'),'92' => __('Order_status 92')];
    }     


    public function getOrderStatusTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['order_status'];
        $list = $this->getOrderStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
